package com.itheima.health.jobs;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.health.service.OrderSettingService;
import lombok.extern.slf4j.Slf4j;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 预约设置清理
 */
@Slf4j
public class ClearOrderSetting {

    @Reference
    OrderSettingService orderSettingService;

    public void clearOrderSettingJob() {
        log.info("====清理预约任务开始了====");
        // 清理预约设置
        // 获取当前时间
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        String date = df.format(new Date());
        // rpc调用
        orderSettingService.deleteByOrderDate(date);
    }
}
